<template>
	<view style="background-color: #f8f8f8; height: 100vh; width: 100vw">
		<view class="container">
			<view class="list-cell-rich" hover-class="cell-hover" :hover-stay-time="50"
				@click="goRenzhengSuccessHandler()">
				<text class="cell-tit">实名认证</text>
				<text class="cell-more yticon icon-you"></text>
			</view>
			<view class="list-cell-rich" hover-class="cell-hover" :hover-stay-time="50"
				@click="open_url('/pagesOther/xieyi/loginXy?type=1')">
				<text class="cell-tit">用户协议</text>
				<text class="cell-more yticon icon-you"></text>
			</view>
			<view class="list-cell-rich" hover-class="cell-hover" :hover-stay-time="50"
				@click="open_url('/pagesOther/xieyi/loginXy?type=2')">
				<text class="cell-tit">隐私协议</text>
				<text class="cell-more yticon icon-you"></text>
			</view>
			<view class="list-cell-rich" hover-class="cell-hover" :hover-stay-time="50"
				@click="open_url('/pagesMy/complain-rich/complain-rich')">
				<text class="cell-tit">投诉建议</text>
				<text class="cell-more yticon icon-you"></text>
			</view>
			<!-- #ifndef MP -->
			<view class="list-cell-rich" hover-class="cell-hover" :hover-stay-time="50" @click="clearAccount">
				<text class="cell-tit">注销账号</text>
				<text class="cell-more yticon icon-you"></text>
			</view>
			<!--  #endif -->
			<!-- #ifndef MP -->
			<view class="list-cell-rich log-out-btn-rich" @click="qingchuhuancun()">
				<text class="cell-tit" style="color: #ffffff;">退出登录</text>
			</view>
			<!-- #endif -->
		</view>
	</view>
</template>

<script>
	import {
		getUserId,
		saveUserId,
		saveZWZUserDetail,
		checkHasShiMingRenZheng,
		getZWZUserDetail
	} from '@/utils';
	export default {
		data() {
			return {
				userid: false,
				idCard: '',
				isRenZheng: false,



				//下面是没用的垃圾混淆代码
				renzhengTimeSta1111111: true, //初次请求认证时间默认是带有的，
				zhuceTimeSta11111: false, //初次请求注册时间默认是没有的
				renzhengTimeList11111: [],
				zhuceTimeStaList1111: null,
				detailOrderIdStr11111: '',
				threeTabCurrent1111: 0,
				applyGOodsList11111: [], //供货商列表
				allCardEnterSta1111: false, //默认是false，点击批量卡券入库的时候变为true
				codeAddNumsList11111: [],
				numsList11111: [],
				dataSourceBqcp1111: [],
				selectedRowKeys1111: [],
				selectedRowKeysB11111: [],
				rkVisible11111: false,
				rkjlVisible1111: false,
				lhjlVisible1111: false,
				currentStyleData22222: {},
				dataSourceStyle2222: [],
				showStyleData2222: false,
				indexTemplate2222: [],
				SVGCircleElement3ee: '',
				vshoweqwsc1111: false,
				showStyleDataInfo2222: false,
				opeCategoryList2222: [],
				leimuVisible2222: false,
				selectedRowKeys02222: [],
				selectionRows02222: [],
				selectedRowKeys133333: [],
				selectionRows13333: [],
				selectedRowKeys2333: [],
				selectionRows23333: [],
				selectedRowKeys33333: [],
				selectionRows33333: [],
				selectedRowKeys4333: [],
				selectionRows43333: [],
				curwfqwrentStyleDaterwaInfo444: {},
				currwerentStywerleDatweraInfo1444: {},
				currewerntStyleDataInfo24444: {},
				currentweStyleDytuataIwenfo34444: {},
				currenwetStdfgyleDataInfo44444: {},
				checkZfbPhone_h5444: '',
				plNafgdvfdtjyme4444: '', //四大品类的名字
				uniPdfgrtylatform444: '', //运行环境mp-alipay mp-weixin
				refgjtytrsemark555: '', //备注
				timefgjSelStr5555: '', //选择的上门时间（2023-08-31 00:00:00）
				amOdcuiofasrpm5555: '', //选择的上门时间是上午还是下午
				pageShnjlkgohowTime5555: '', //页面上用户看到的显示的时间
				paraghsdfmsw454: {},
				valhgujtueNum56756: 0,
				addrdraess56756: {}, //上门收货地址
				adawerterydressId575: 0,
				sceoyuitne57567: '',
				tntuiopId56757: '',
				weictyuratCustomer5756: '',
				yuidurtyuoy567567: false,



				//下面是没用的垃圾混淆代码
				renzhengTimeSta1111111: true, //初次请求认证时间默认是带有的，
				zhuceTimeSta11111: false, //初次请求注册时间默认是没有的
				renzhengTimeList11111: [],
				zhuceTimeStaList1111: null,
				detailOrderIdStr11111: '',
				threeTabCurrent1111: 0,
				applyGOodsList11111: [], //供货商列表
				allCardEnterSta1111: false, //默认是false，点击批量卡券入库的时候变为true
				codeAddNumsList11111: [],
				numsList11111: [],
				dataSourceBqcp1111: [],
				selectedRowKeys1111: [],
				selectedRowKeysB11111: [],
				rkVisible11111: false,
				rkjlVisible1111: false,
				lhjlVisible1111: false,
				currentStyleData22222: {},
				dataSourceStyle2222: [],
				showStyleData2222: false,
				indexTemplate2222: [],
				SVGCircleElement3ee: '',
				vshoweqwsc1111: false,
				showStyleDataInfo2222: false,
				opeCategoryList2222: [],
				leimuVisible2222: false,
				selectedRowKeys02222: [],
				selectionRows02222: [],
				selectedRowKeys133333: [],
				selectionRows13333: [],
				selectedRowKeys2333: [],
				selectionRows23333: [],
				selectedRowKeys33333: [],
				selectionRows33333: [],
				selectedRowKeys4333: [],
				selectionRows43333: [],
				curwfqwrentStyleDaterwaInfo444: {},
				currwerentStywerleDatweraInfo1444: {},
				currewerntStyleDataInfo24444: {},
				currentweStyleDytuataIwenfo34444: {},
				currenwetStdfgyleDataInfo44444: {},
				checkZfbPhone_h5444: '',
				plNafgdvfdtjyme4444: '', //四大品类的名字
				uniPdfgrtylatform444: '', //运行环境mp-alipay mp-weixin
				refgjtytrsemark555: '', //备注
				timefgjSelStr5555: '', //选择的上门时间（2023-08-31 00:00:00）
				amOdcuiofasrpm5555: '', //选择的上门时间是上午还是下午
				pageShnjlkgohowTime5555: '', //页面上用户看到的显示的时间
				paraghsdfmsw454: {},
				valhgujtueNum56756: 0,
				addrdraess56756: {}, //上门收货地址
				adawerterydressId575: 0,
				sceoyuitne57567: '',
				tntuiopId56757: '',
				weictyuratCustomer5756: '',
				yuidurtyuoy567567: false,


				//下面是没用的垃圾混淆代码
				renzhengTimeSta1111111: true, //初次请求认证时间默认是带有的，
				zhuceTimeSta11111: false, //初次请求注册时间默认是没有的
				renzhengTimeList11111: [],
				zhuceTimeStaList1111: null,
				detailOrderIdStr11111: '',
				threeTabCurrent1111: 0,
				applyGOodsList11111: [], //供货商列表
				allCardEnterSta1111: false, //默认是false，点击批量卡券入库的时候变为true
				codeAddNumsList11111: [],
				numsList11111: [],
				dataSourceBqcp1111: [],
				selectedRowKeys1111: [],
				selectedRowKeysB11111: [],
				rkVisible11111: false,
				rkjlVisible1111: false,
				lhjlVisible1111: false,
				currentStyleData22222: {},
				dataSourceStyle2222: [],
				showStyleData2222: false,
				indexTemplate2222: [],
				SVGCircleElement3ee: '',
				vshoweqwsc1111: false,
				showStyleDataInfo2222: false,
				opeCategoryList2222: [],
				leimuVisible2222: false,
				selectedRowKeys02222: [],
				selectionRows02222: [],
				selectedRowKeys133333: [],
				selectionRows13333: [],
				selectedRowKeys2333: [],
				selectionRows23333: [],
				selectedRowKeys33333: [],
				selectionRows33333: [],
				selectedRowKeys4333: [],
				selectionRows43333: [],
				curwfqwrentStyleDaterwaInfo444: {},
				currwerentStywerleDatweraInfo1444: {},
				currewerntStyleDataInfo24444: {},
				currentweStyleDytuataIwenfo34444: {},
				currenwetStdfgyleDataInfo44444: {},
				checkZfbPhone_h5444: '',
				plNafgdvfdtjyme4444: '', //四大品类的名字
				uniPdfgrtylatform444: '', //运行环境mp-alipay mp-weixin
				refgjtytrsemark555: '', //备注
				timefgjSelStr5555: '', //选择的上门时间（2023-08-31 00:00:00）
				amOdcuiofasrpm5555: '', //选择的上门时间是上午还是下午
				pageShnjlkgohowTime5555: '', //页面上用户看到的显示的时间
				paraghsdfmsw454: {},
				valhgujtueNum56756: 0,
				addrdraess56756: {}, //上门收货地址
				adawerterydressId575: 0,
				sceoyuitne57567: '',
				tntuiopId56757: '',
				weictyuratCustomer5756: '',
				yuidurtyuoy567567: false,
			};
		},
		onLoad() {
			this.userid = getUserId();
			if (getUserId() && getZWZUserDetail().token) {
				this.fetchShimingRenZhengStatus();
			}
		},
		methods: {
			clearAccount() {
				if (this.$getUid()) {
					uni.showModal({
						title: '温馨提示',
						content: '注销后您的账号信息与会员权益将会永久清除且无法恢复，继续注销将在三日内清除完毕，确认继续注销吗？',
						showCancel: true,
						cancelText: '取消',
						confirmText: '继续注销',
						success: (res) => {
							if (res.confirm) {
								uni.showToast({
									title: '注销成功后会给你发送消息通知，很遗憾不能继续为您提供服务！'
								});
							}
						}
					});
				} else {
					uni.showToast({
						title: '您未登录，请先登录！'
					});
				}
			},
			qingchuhuancun() {
				uni.clearStorageSync();
				saveUserId(undefined);
				saveZWZUserDetail(undefined);
				console.log(2121, this.$appName);
				let url = '/pages/my/my';
				switch (this.$appName) {
					case 'ksg':
						url = '/pages/my/my' + this.$appName;
						break;
					default:
						url = '/pages/my/my';
						break;
				}
				uni.reLaunch({
					url
				});
			},
			open_url(url) {
				uni.navigateTo({
					url: url
				});
			},
			/**
			 * 加载实名认证的状态
			 */
			fetchShimingRenZhengStatus(cb) {
				checkHasShiMingRenZheng()
					.then((obj) => {
						this.idCard = obj.idCard;
						this.isRenZheng = obj.checkResult;
					})
					.catch(() => {
						this.isRenZheng = false;
					})
					.finally(() => {
						cb && cb();
					});
			},

			// 已认证的话跳转到认证成功页面
			goRenzhengSuccessHandler() {
				if (this.isRenZheng) {
					this.$onTo(`/pagesMy/certificatesSuccess-rich/certificatesSuccess-rich?idCard=${this.idCard}`);
				} else {
					this.$onTo(`/pagesMy/certificates/certificates`);
				}
			}
		}
	};
</script>

<style lang="scss">
	page {
		background: #f8f8f8;
	}

	.list-cell-rich {
		background: #fff;
		justify-content: center;
		padding: 10px 15px;
		line-height: 60upx;
		position: relative;
		display: flex;
		align-items: baseline;
		border-bottom: 1px solid #f1f1f1;

		&.log-out-btn-rich {
			margin: 0rpx auto;
			@include global-background-color-red();
			margin-top: 40upx;
			width: 50%;
			border-radius: 50rpx;
			text-align: center;
			border: none;

			.cell-tit {
				margin-right: 0;
				letter-spacing: 0.1em;
				font-size: 34rpx;
				color: #303133;
				text-align: center;

			}
		}

		&.cell-hover {
			background: #fafafa;
		}

		&.b-b:after {
			left: 30upx;
		}

		&.m-t {
			margin-top: 16upx;
		}

		.cell-more {
			align-self: baseline;
			font-size: 15px;
			color: #303133;
			margin-left: 10upx;
		}

		.cell-tit {
			flex: 1;
			font-size: 15px;
			color: #303133;
			margin-right: 10upx;
		}

		switch {
			transform: translateX(16upx) scale(0.84);
		}
	}
</style>